package com.simple.behavior.superclassandsubclass.strategy;

import com.simple.LogUtil;

/**
 * @author simple
 * @version 1.0
 * @date 2019-01-04 16:31
 * @since 1.0
 */
public class Start {
    public static void main(String[] args) {
        // 加法
        Calculator calculator = new Plus();
        String expPlus = "3+5";
        int resultPlus = calculator.calculate(expPlus);
        LogUtil.info("计算: " + expPlus + "=" + resultPlus);
        // 减法
        calculator = new Minus();
        String expMinus = "3-5";
        int resultMinus = calculator.calculate(expMinus);
        LogUtil.info("计算: " + expMinus + "=" + resultMinus);
        // 乘法
        calculator = new Multiply();
        String expMultiply = "3*5";
        int resultMultiply = calculator.calculate(expMultiply);
        LogUtil.info("计算: " + expMultiply.replace("*", "×") + "=" + resultMultiply);
    }
}
